package com.example.concurrentprogramming8016.future.completablefuture;

import java.util.concurrent.CompletableFuture;

/**
 * @author liyanhao
 * @Date 2023-01-08 21:34
 * 两个线程任务相比较，两个全部执行完成，才进行下一步操作，不关心运行结果
 */
public class RunAfterBothDemo {
    public static void main(String[] args) {
        CompletableFuture.runAsync(() -> {
            System.out.println("第一阶段");
        }).runAfterBoth(CompletableFuture.runAsync(() -> {
            System.out.println("第二阶段");
        }), () -> {
            System.out.println("最终");
        }).join();
    }
}
